package com.pinxixi.search.controller;

import com.netflix.discovery.converters.Auto;
import com.pinxixi.api.search.SearchControllerApi;
import com.pinxixi.framework.domain.goods.Item;
import com.pinxixi.framework.model.response.CommonCode;
import com.pinxixi.framework.model.response.ListResponseResult;
import com.pinxixi.framework.model.response.QueryResponseResult;
import com.pinxixi.framework.model.response.QueryResult;
import com.pinxixi.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RequestMapping("/search")
@RestController
@CrossOrigin(origins = "*")
public class SearchController implements SearchControllerApi {

    @Autowired
    private SearchService searchService;

    @Override
    @GetMapping("/find")
    public QueryResponseResult<Map> search(String keyword, Integer page, String params) throws IOException {
        System.out.println(params);
        return searchService.search(page,keyword,params);
    }
}
